package com.work03.dao;

import com.work03.pojo.Customer;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 绛河
 */
@Mapper
public interface CustomerMapper {
    /**
     * 新增
     * @param customer
     */
    @Insert("INSERT INTO t_customer (id,username, job, phone, sex) VALUES (null,#{username}, #{job}, #{phone}, #{sex})")
    void insert(Customer customer);


    /**
     * 根据工作查询
     * @param job
     * @return
     */
    @Select("SELECT * FROM t_customer WHERE job = #{job}")
    List<Customer> selectCustomersByJob(String job);

    @Select("SELECT * FROM t_customer WHERE id = #{id}")
    Customer selectById(Integer id);

}